package edu.westga.cs3202.sokoban;

import java.awt.*;
import javax.swing.*;

/**
 * Sokoban creates and shows the GUI
 * 
 * @author Lewis Williams
 * @version 2011.2.17
 */
public class Sokoban{
	static GamePanel GUIPanel;
	static JFrame frame;

	/**
	 * Adds a GamePanel to the newly created JFrame
	 */
	public static void createAndShowGUI() {
		frame = new JFrame("Sokoban");
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	
		GameBoard board = new GameBoard();
		frame.getContentPane().add(new GamePanel(board));
		
		frame.setPreferredSize(new Dimension(board.getBoardColumns() * 21, board.getBoardRows() * 23));
		frame.pack();
		frame.setVisible(true);
	}

	/**
	 * Makes sure the GUI runs on the event dispatch thread.
	 * @param args
	 */
	public static void main(String [] args) {
		javax.swing.SwingUtilities.invokeLater(new Runnable() {
			public void run() {
				createAndShowGUI();
			}
		} );
	}
}